//图片上传
function oneImageUpload(photoUpload, ThumbImg,msgText,resultUrl) {
    layui.use('upload', function () {
        var $ = layui.jquery
            , upload = layui.upload;


        //普通图片上传
        var uploadInst = upload.render({
            elem: photoUpload
            ,url: ctx + 'common/uploadImg'
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $(ThumbImg).attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    // console.log(res)
                    return layer.msg('上传失败');
                }
                //上传成功
                $(resultUrl).val(res.url);
                // console.log(res)
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var msgText = $(msgText);
                msgText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                msgText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });

    });
}